<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="funA()">if</button>
<button onclick="funB()">if-else</button>
<button onclick="funC()">多重if</button>
<button onclick="funD()">switch-case</button>
<hr/>
<span id="s1"></span>
</body>
</html>
<script>
    function funA() {
        let num = Math.floor(Math.random() * 100 + 1)
        if (num > 60) {
            document.getElementById('s1').innerText = num + '大于60'
        }
    }

    function funB() {
        let num = Math.floor(Math.random() * 100 + 1)
        if (num > 60) {
            document.getElementById('s1').innerText = num + '大于60'
        } else {
            document.getElementById('s1').innerText = num + '小于60'
        }
    }

    function funC() {
        let num = Math.floor(Math.random() * 100 + 1)
        if (num === 100) {
            document.getElementById('s1').innerText = num + '很优秀'
        } else if (num > 80) {
            document.getElementById('s1').innerText = num + '大于80'
        } else if (num > 60) {
            document.getElementById('s1').innerText = num + '大于60'
        } else {
            document.getElementById('s1').innerText = num + '不及格'
        }
    }

    function funD() {
        let num = Math.floor(Math.random() * 7 + 1)
        switch (num) {
            case 1:
                document.getElementById('s1').innerText = '星期一'
                break
            case 2:
                document.getElementById('s1').innerText = '星期二'
                break
            case 3:
                document.getElementById('s1').innerText = '星期三'
                break
            case 4:
                document.getElementById('s1').innerText = '星期四'
                break
            case 5:
                document.getElementById('s1').innerText = '星期五'
                break
            case 6:
                document.getElementById('s1').innerText = '星期六'
                break
            case 7:
                document.getElementById('s1').innerText = '星期日'
                break
        }
    }
</script>